﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sispe.Entities;
using Sispe.BussinesLogic;
using Microsoft.Practices.Unity;


namespace Sispe.UI
{
    public partial class frmPersonasLibres : Form
    {
        [Dependency]
        public IPersonaBL personaBL { get; set; }

        [Dependency]
        public ITrabajadorBL trabajadorBL { get; set; }

        [Dependency]
        public IDerechoHabienteBL derHabBL { get; set; }

        public frmPersonasLibres()
        {
            InitializeComponent();
            this.BuildUp();
        }

        private void frmPersonasLibres_Load(object sender, EventArgs e)
        {
            cargarData();
        }

        private void cargarData()
        {
            var _personas = personaBL.GetAllFromOnlyPersona();
            pERSONABindingSource.DataSource = _personas;
            pERSONABindingSource.ResetBindings(true);
        }

        public PERSONA currentPersona { get; set; }

        private void pERSONADataGridView_DoubleClick(object sender, EventArgs e)
        {
            var isExtend = true;
            if (isExtend == true)
            {
                currentPersona = pERSONABindingSource.Current as PERSONA;
                this.Close();
            }
        }
     

    }
}
